package com.yuwei.order.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.database.entity.AddressEntity
import com.yuwei.order.R

class AddressAdapter: BaseQuickAdapter<AddressEntity, BaseViewHolder>(
    R.layout.item_address
){
    override fun convert(holder: BaseViewHolder, item: AddressEntity) {
        holder.setText(R.id.item_tv_name,item.name)
        holder.setText(R.id.item_tv_address,"${item.address}${item.fullAddress}")
        holder.setText(R.id.item_tv_phone,item.phone)
        holder.setText(R.id.item_tv_address_label,item.tag)
        val check = holder.getView<ImageView>(R.id.item_iv_check)
        if(item.isChecked){
            check.setImageResource(R.drawable.radio_selected)
        }else{
            check.setImageResource(R.drawable.radio_un_selected)
        }
    }

}